﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace BookClubIt.Data.Commands
{
   public class EmailCommandList
    {
       public static SqlCommand GetRegisteredEmail
       {
           get
           {
               SqlCommand command = new SqlCommand();
               command.Parameters.Add("@User_Id", SqlDbType.Int);
               command.CommandType = CommandType.Text;
               command.CommandText = @"SELECT Email FROM Member WHERE Id = @User_Id";
               return command;
           }
       }
       public static SqlCommand GetBookClubEmails
       {
           get
           {
               SqlCommand command = new SqlCommand();
               command.Parameters.Add("@Bookclub_Id", SqlDbType.Int);
               command.Parameters.Add("@Topic_Id", SqlDbType.Int);
               command.Parameters.Add("@User_Id", SqlDbType.Int);
               command.CommandType = CommandType.Text;
               command.CommandText = @"SELECT m.Email 
                                       FROM Member m 
                                       JOIN Member_Book_Club mbc on m.Id = mbc.Member_Id
                                       WHERE mbc.Book_Club_Id = @Bookclub_Id";
               return command;
           }
       }
       public static SqlCommand GetBookClubAdminEmails
       {
           get
           {
               SqlCommand command = new SqlCommand();
               command.Parameters.Add("@Bookclub_Id", SqlDbType.Int);
               command.Parameters.Add("@User_Id", SqlDbType.Int);
               command.CommandType = CommandType.Text;
               command.CommandText = @"SELECT * 
                                       FROM Member m 
                                       JOIN Admin_Book_Club abc on m.Id = abc.User_Id
                                       WHERE abc.Book_Club_Id = @Bookclub_Id";
               return command;
           }
       }
    }
}
